﻿using System;
using System.Collections.Generic;
using UnityEngine;

namespace RenderHeads.Media.AVProVideo
{
	// Token: 0x02000030 RID: 48
	public abstract class BaseMediaPlayer : IMediaPlayer, IMediaControl, IMediaInfo, IMediaProducer, IMediaSubtitles, IDisposable
	{
		// Token: 0x06000138 RID: 312
		public abstract string GetVersion();

		// Token: 0x06000139 RID: 313
		public abstract bool OpenVideoFromFile(string path, long offset, string httpHeaderJson);

		// Token: 0x0600013A RID: 314 RVA: 0x0000A724 File Offset: 0x00008924
		public virtual bool OpenVideoFromBuffer(byte[] buffer)
		{
			return false;
		}

		// Token: 0x0600013B RID: 315
		public abstract void CloseVideo();

		// Token: 0x0600013C RID: 316
		public abstract void SetLooping(bool bLooping);

		// Token: 0x0600013D RID: 317
		public abstract bool IsLooping();

		// Token: 0x0600013E RID: 318
		public abstract bool HasMetaData();

		// Token: 0x0600013F RID: 319
		public abstract bool CanPlay();

		// Token: 0x06000140 RID: 320
		public abstract void Play();

		// Token: 0x06000141 RID: 321
		public abstract void Pause();

		// Token: 0x06000142 RID: 322
		public abstract void Stop();

		// Token: 0x06000143 RID: 323
		public abstract void Rewind();

		// Token: 0x06000144 RID: 324
		public abstract void Seek(float timeMs);

		// Token: 0x06000145 RID: 325
		public abstract void SeekFast(float timeMs);

		// Token: 0x06000146 RID: 326
		public abstract float GetCurrentTimeMs();

		// Token: 0x06000147 RID: 327
		public abstract float GetPlaybackRate();

		// Token: 0x06000148 RID: 328
		public abstract void SetPlaybackRate(float rate);

		// Token: 0x06000149 RID: 329
		public abstract float GetDurationMs();

		// Token: 0x0600014A RID: 330
		public abstract int GetVideoWidth();

		// Token: 0x0600014B RID: 331
		public abstract int GetVideoHeight();

		// Token: 0x0600014C RID: 332
		public abstract float GetVideoDisplayRate();

		// Token: 0x0600014D RID: 333
		public abstract bool HasAudio();

		// Token: 0x0600014E RID: 334
		public abstract bool HasVideo();

		// Token: 0x0600014F RID: 335
		public abstract bool IsSeeking();

		// Token: 0x06000150 RID: 336
		public abstract bool IsPlaying();

		// Token: 0x06000151 RID: 337
		public abstract bool IsPaused();

		// Token: 0x06000152 RID: 338
		public abstract bool IsFinished();

		// Token: 0x06000153 RID: 339
		public abstract bool IsBuffering();

		// Token: 0x06000154 RID: 340 RVA: 0x0000A728 File Offset: 0x00008928
		public virtual int GetTextureCount()
		{
			return 1;
		}

		// Token: 0x06000155 RID: 341
		public abstract Texture GetTexture(int index = 0);

		// Token: 0x06000156 RID: 342
		public abstract int GetTextureFrameCount();

		// Token: 0x06000157 RID: 343 RVA: 0x0000A72C File Offset: 0x0000892C
		public virtual long GetTextureTimeStamp()
		{
			return long.MinValue;
		}

		// Token: 0x06000158 RID: 344
		public abstract bool RequiresVerticalFlip();

		// Token: 0x06000159 RID: 345 RVA: 0x0000A738 File Offset: 0x00008938
		public virtual float[] GetTextureTransform()
		{
			float[] array = new float[6];
			array[0] = 1f;
			array[3] = 1f;
			return array;
		}

		// Token: 0x0600015A RID: 346
		public abstract void MuteAudio(bool bMuted);

		// Token: 0x0600015B RID: 347
		public abstract bool IsMuted();

		// Token: 0x0600015C RID: 348
		public abstract void SetVolume(float volume);

		// Token: 0x0600015D RID: 349 RVA: 0x0000A750 File Offset: 0x00008950
		public virtual void SetBalance(float balance)
		{
		}

		// Token: 0x0600015E RID: 350
		public abstract float GetVolume();

		// Token: 0x0600015F RID: 351 RVA: 0x0000A754 File Offset: 0x00008954
		public virtual float GetBalance()
		{
			return 0f;
		}

		// Token: 0x06000160 RID: 352
		public abstract int GetAudioTrackCount();

		// Token: 0x06000161 RID: 353
		public abstract int GetCurrentAudioTrack();

		// Token: 0x06000162 RID: 354
		public abstract void SetAudioTrack(int index);

		// Token: 0x06000163 RID: 355
		public abstract string GetCurrentAudioTrackId();

		// Token: 0x06000164 RID: 356
		public abstract int GetCurrentAudioTrackBitrate();

		// Token: 0x06000165 RID: 357 RVA: 0x0000A75C File Offset: 0x0000895C
		public virtual int GetNumAudioChannels()
		{
			return -1;
		}

		// Token: 0x06000166 RID: 358
		public abstract int GetVideoTrackCount();

		// Token: 0x06000167 RID: 359
		public abstract int GetCurrentVideoTrack();

		// Token: 0x06000168 RID: 360
		public abstract void SetVideoTrack(int index);

		// Token: 0x06000169 RID: 361
		public abstract string GetCurrentVideoTrackId();

		// Token: 0x0600016A RID: 362
		public abstract int GetCurrentVideoTrackBitrate();

		// Token: 0x0600016B RID: 363
		public abstract float GetVideoFrameRate();

		// Token: 0x0600016C RID: 364
		public abstract float GetBufferingProgress();

		// Token: 0x0600016D RID: 365
		public abstract void Update();

		// Token: 0x0600016E RID: 366
		public abstract void Render();

		// Token: 0x0600016F RID: 367
		public abstract void Dispose();

		// Token: 0x06000170 RID: 368 RVA: 0x0000A760 File Offset: 0x00008960
		public ErrorCode GetLastError()
		{
			return this._lastError;
		}

		// Token: 0x06000171 RID: 369 RVA: 0x0000A768 File Offset: 0x00008968
		public string GetPlayerDescription()
		{
			return this._playerDescription;
		}

		// Token: 0x06000172 RID: 370 RVA: 0x0000A770 File Offset: 0x00008970
		public virtual bool PlayerSupportsLinearColorSpace()
		{
			return true;
		}

		// Token: 0x06000173 RID: 371 RVA: 0x0000A774 File Offset: 0x00008974
		public virtual int GetBufferedTimeRangeCount()
		{
			return 0;
		}

		// Token: 0x06000174 RID: 372 RVA: 0x0000A778 File Offset: 0x00008978
		public virtual bool GetBufferedTimeRange(int index, ref float startTimeMs, ref float endTimeMs)
		{
			return false;
		}

		// Token: 0x06000175 RID: 373 RVA: 0x0000A77C File Offset: 0x0000897C
		public void SetTextureProperties(FilterMode filterMode = FilterMode.Bilinear, TextureWrapMode wrapMode = TextureWrapMode.Clamp, int anisoLevel = 0)
		{
			this._defaultTextureFilterMode = filterMode;
			this._defaultTextureWrapMode = wrapMode;
			this._defaultTextureAnisoLevel = anisoLevel;
			this.ApplyTextureProperties(this.GetTexture(0));
		}

		// Token: 0x06000176 RID: 374 RVA: 0x0000A7A0 File Offset: 0x000089A0
		protected virtual void ApplyTextureProperties(Texture texture)
		{
			if (texture != null)
			{
				texture.filterMode = this._defaultTextureFilterMode;
				texture.wrapMode = this._defaultTextureWrapMode;
				texture.anisoLevel = this._defaultTextureAnisoLevel;
			}
		}

		// Token: 0x06000177 RID: 375 RVA: 0x0000A7D4 File Offset: 0x000089D4
		public virtual void GrabAudio(float[] buffer, int floatCount, int channelCount)
		{
		}

		// Token: 0x06000178 RID: 376 RVA: 0x0000A7D8 File Offset: 0x000089D8
		public virtual bool IsPlaybackStalled()
		{
			return false;
		}

		// Token: 0x06000179 RID: 377 RVA: 0x0000A7DC File Offset: 0x000089DC
		public bool LoadSubtitlesSRT(string data)
		{
			if (string.IsNullOrEmpty(data))
			{
				this._subtitles = null;
				this._currentSubtitle = null;
			}
			else
			{
				this._subtitles = Helper.LoadSubtitlesSRT(data);
			}
			return this._subtitles != null;
		}

		// Token: 0x0600017A RID: 378 RVA: 0x0000A814 File Offset: 0x00008A14
		public virtual void UpdateSubtitles()
		{
			if (this._subtitles != null)
			{
				float currentTimeMs = this.GetCurrentTimeMs();
				int num = 0;
				if (this._currentSubtitle != null && !this._currentSubtitle.IsTime(currentTimeMs))
				{
					if (currentTimeMs > (float)this._currentSubtitle.timeEndMs)
					{
						num = this._currentSubtitle.index + 1;
					}
					this._currentSubtitle = null;
				}
				if (this._currentSubtitle == null)
				{
					for (int i = num; i < this._subtitles.Count; i++)
					{
						if (this._subtitles[i].IsTime(currentTimeMs))
						{
							this._currentSubtitle = this._subtitles[i];
							break;
						}
					}
				}
			}
		}

		// Token: 0x0600017B RID: 379 RVA: 0x0000A8D0 File Offset: 0x00008AD0
		public virtual int GetSubtitleIndex()
		{
			int result = -1;
			if (this._currentSubtitle != null)
			{
				result = this._currentSubtitle.index;
			}
			return result;
		}

		// Token: 0x0600017C RID: 380 RVA: 0x0000A8F8 File Offset: 0x00008AF8
		public virtual string GetSubtitleText()
		{
			string result = string.Empty;
			if (this._currentSubtitle != null)
			{
				result = this._currentSubtitle.text;
			}
			return result;
		}

		// Token: 0x0600017D RID: 381 RVA: 0x0000A924 File Offset: 0x00008B24
		public virtual void OnEnable()
		{
		}

		// Token: 0x04000142 RID: 322
		protected string _playerDescription = string.Empty;

		// Token: 0x04000143 RID: 323
		protected ErrorCode _lastError;

		// Token: 0x04000144 RID: 324
		protected FilterMode _defaultTextureFilterMode = FilterMode.Bilinear;

		// Token: 0x04000145 RID: 325
		protected TextureWrapMode _defaultTextureWrapMode = TextureWrapMode.Clamp;

		// Token: 0x04000146 RID: 326
		protected int _defaultTextureAnisoLevel = 1;

		// Token: 0x04000147 RID: 327
		protected List<Subtitle> _subtitles;

		// Token: 0x04000148 RID: 328
		protected Subtitle _currentSubtitle;
	}
}
